﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

namespace WellDone
{
    public sealed partial class CloseCheckDialog : Page
    {
        public event EventHandler CloseRequested;
        public bool bCanceled = false;
        public bool bCash = false;
        public bool bCredit = false;
        public CloseCheckDialog()
        {
            this.InitializeComponent();
        }

        public void init(decimal dAmount)
        {
            tbAmount.Text = "$" + dAmount.ToString("N");
        }
        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            // Determine which option was selected
            bCash = rbCash.IsChecked == true;
            bCredit = rbCredit.IsChecked == true;
            // Close the dialog
            if (this.CloseRequested != null)
            {
                this.CloseRequested(this, EventArgs.Empty);
            }
        }

        private void btnCancel_Click(object sender, RoutedEventArgs e)
        {
            // Set "Canceled" 
            bCanceled = true;
            if (this.CloseRequested != null)
            {
                this.CloseRequested(this, EventArgs.Empty);
            }
        }
    }
}
